﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
using System.Data;

namespace PTTPOS_Solution.DAL
{
    public class Company_DA
    {
        public static DataTable getcompany()
        {
            DataTable tbl = new DataTable();
            MySqlCommand com = new MySqlCommand("select * from tblcompanies", Connection_PTTPOS.GetConnection());
            com.Connection.Open();
            MySqlDataAdapter adapter = new MySqlDataAdapter(com);
            adapter.Fill(tbl);
            com.Connection.Close();
            return tbl;
        }

        public static void UpdateCompany(string id, string id_print)
        {
            MySqlCommand com = new MySqlCommand("update tblcompanies set printbill=@id_print where id=@id", Connection_PTTPOS.GetConnection());
            com.Parameters.AddWithValue("@id_print", id_print);
            com.Parameters.AddWithValue("@id", id);
            com.Connection.Open();
            com.ExecuteNonQuery();
            com.Connection.Close();
        } 
        
    }
}
